using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityGameFramework.Runtime;

//自动生成于：2021/3/4 16:25:03
namespace StarForce
{
    public partial class RecourseUpdatePage : MonoBehaviour
    {
        [SerializeField] private Text m_DescriptionText = null;

        [SerializeField] private Slider m_ProgressSlider = null;

        [SerializeField] private GameObject m_New = null;

        [SerializeField] private Button m_Down = null;

        [SerializeField] private Button m_Cancel = null;

        private string m_DownPath;

        private void Awake()
        {
//            m_Down.onClick.AddListener(OnDown);
//            m_Cancel.onClick.AddListener(OnCancel);
        }

        private void OnCancel()
        {
            UnityGameFramework.Runtime.GameEntry.Shutdown(ShutdownType.Quit);
        }

        private void OnDown()
        {
            Application.OpenURL(m_DownPath);
        }

        private void Start()
        {
//            m_New.SetActive(false);
            m_DescriptionText.text = "正在创建美丽福田中。。。";
        }

        private void Update()
        {
        }

        /// <summary>
        /// 设置下载路径
        /// </summary>
        /// <param name="url"></param>
        public void SetDownUrl(string url)
        {
            m_DownPath = url;
        }

        /// <summary>
        /// 打开版本更新
        /// </summary>
        public void OpenNew()
        {
//            m_New.SetActive(true);
        }

        /// <summary>
        ///  加载资源暂时让他跑一下
        /// </summary>
        /// <param name="progress"></param>
        public void SetProgressSlider(float progress)
        {
            m_ProgressSlider.value = progress;
        }

        /// <summary>
        /// 设置下载过程
        /// </summary>
        /// <param name="progress"></param>
        /// <param name="description"></param>
        public void SetProgress(float progress, string description)
        {
            m_ProgressSlider.value = progress;
            m_DescriptionText.text = description;
        }

        /// <summary>
        /// 设置提示
        /// </summary>
        /// <param name="description"></param>
        public void SetProgressTxt(string description)
        {
            m_DescriptionText.text = description;
        }
    }
}